import request from '@/utils/request'
import qs from 'qs'

export function add(data) {
  return request({
    url: 'subject/add',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'subject/delete',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'subject/update',
    method: 'put',
    data
  })
}
export function relationPage(data) {
  return request({
    url: 'subject/relationPage' + '?' + qs.stringify(data, { indices: false }),
    method: 'get'
  })
}
export function createRelation(data) {
  return request({
    url: 'subject/createRelation',
    method: 'post',
    data
  })
}
export function deleteRelation(data) {
  return request({
    url: 'subject/deleteRelation',
    method: 'DELETE',
    data
  })
}
export function modifyRelation(data) {
  return request({
    url: 'subject/modifyRelation',
    method: 'PUT',
    data
  })
}

export default { add, edit, del, relationPage, createRelation, deleteRelation, modifyRelation }
